<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html>

	<head>
		<title>库存管理-库存调配</title>
		<meta charset="utf-8">
		<link rel="stylesheet" type="text/css" href="<%=basePath%>libs/bootstrap-3.3.7-dist/css/bootstrap.min.css">
		<link rel="stylesheet" type="text/css" href="<%=basePath%>css/reset.css">
		<link rel="stylesheet" type="text/css" href="<%=basePath%>css/style.css">
		<link rel="stylesheet" type="text/css" href="<%=basePath%>css/iframe.css">

	</head>

	<body>
		<div id="mainContent">
			<div id="mainContent_content">
				<div class="page_header">
					<a>库存调配</a>
				</div>
				<div class="search">
					<form class="form" method="post" action="<%=basePath%>storageDistribute/selectByWhere.do">
						<p>

							<label>调配单号</label> <input class="form-control" type="text" name="distributeNumber" value="${storageDistributePage.distributeNumber }"></input> <label>
							创建时间</label> <input class="form-control" type="text" name="starttime" value="${storageDistributePage.starttime }" readonly onclick="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd'})"></input>

							<label>至</label> <input class="form-control" type="text" name="endtime" value="${storageDistributePage.endtime }" readonly onclick="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd'})"></input>

							<label>创建人</label> <input class="form-control" type="text" name="createPerson" value="${storageDistributePage.createPerson }"></input> <label>原仓库</label>
							<select name="fromWarehouseID" class="form-control select">
								<option value="">全部</option>
								<c:forEach items="${wm }" var="w">
									<option value="${w.warehousemanagementid }" <c:if test="${storageDistributePage.fromWarehouseID==w.warehousemanagementid}">selected</c:if>>${w.warehousename }</option>
								</c:forEach>
							</select>

						</p>
						<p>
							<label>目标仓库</label>
							<select name="toWarehouseID" class="form-control select">
								<option value="">全部</option>
								<c:forEach items="${wm }" var="w">
									<option value="${w.warehousemanagementid }" <c:if test="${storageDistributePage.toWarehouseID==w.warehousemanagementid}">selected</c:if>>${w.warehousename }</option>
								</c:forEach>
							</select> <label>备注</label> <input type="text" class="form-control doubleWidth" name="remark" value="${storageDistributePage.remark }"></input> <span class="btn"> <input type="submit" value="搜索"
							class="btn btn1"></input> <input type="button" value="清空"
							onclick="clearSearchParam();" class="btn btn2"></input> <input
							type="button" value="新增"
							onclick="location.href='<%=basePath%>storageDistribute/toAdd.do'"
							class="btn btn1"></input>
						</span>
						</p>

					</form>
				</div>

				<div class="tableBox box">
					<table class="table table-bordered table_text_center">
						<thead>
							<tr>
								<th>序号</th>
								<th>操作</th>
								<th>调配单号</th>
								<th>创建时间</th>
								<th>创建人</th>
								<th>状态</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${storageDistributeList }" var="s" varStatus="i">
								<tr>
									<td>${i.index+1 }</td>
									<td>
										<c:if test="${s.status==0 }">
											<a class="btn btn-xs btn1" onclick="location.href='<%=basePath%>storageDistribute/toUpdate.do?storageDistributeID=${s.storageDistributeID }'">编辑</a>
											<a class="btn btn-xs btn_danger" onclick="delStorageDistribute(${s.storageDistributeID});">删除</a>
										</c:if>
										<c:if test="${s.status==1 }">
											<a class="btn btn-xs btn1" onclick="location.href='<%=basePath%>storageDistribute/toDetailsStorageDistribute.do?storageDistributeID=${s.storageDistributeID}'">查看</a>
										</c:if>
									</td>
									<td>${s.distributeNumber }</td>
									<td>
										<fmt:formatDate value='${s.createTime }' pattern="yyyy-MM-dd HH:mm:ss" />
									</td>
									<td>${s.createPerson }</td>
									<td>${s.status==1?"已提交":s.status==0?"未提交":"未知错误" }</td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
				</div>
				<jsp:include page="/jsp/basic/page.jsp"></jsp:include>
			</div>
			<jsp:include page="/jsp/basic/prompt.jsp"></jsp:include>

		</div>
		<script src="<%=basePath%>js/jquery-3.2.1.min.js"></script>
		<script src="<%=basePath%>libs/bootstrap-3.3.7-dist/js/bootstrap.js"></script>
		<script src="<%=basePath%>js/public.js"></script>
		<script src="<%=basePath%>My97DatePickers/WdatePicker.js"></script>
		<script type="text/javascript">
			//清空搜索条件
			function clearSearchParam() {
				$(".search input:text").val("");
				$(".search select").val("");
			}//删除未提交的领料归还信息
			function delStorageDistribute(storageDistributeID) {
				var delFunc = function() {
					$.ajax({
						url: "<%=basePath%>storageDistribute/delStorageDistribute.do",
						type: "post",
						async: false,
						dataType: "json",
						data: "storageDistributeID=" + storageDistributeID,
						success: function(data) {
							if(data.result == "success") {
								Prompt.alert("删除提示", "已删除！");
								location.href = location.href;
							} else {
								Prompt.alert("删除提示", "删除失败！");
							}
						},
						error: function() {
							Prompt.alert("删除提示", "服务器无响应，请刷新页面后重试！");
						}
					});
				}
				Prompt.confirm("提示", "确认要删除该信息吗?删除后无法恢复", delFunc);
			}
		</script>
	</body>

</html>